package org.ttitfly.ttcore.displaytag;

import org.apache.commons.beanutils.PropertyUtils;
import org.displaytag.decorator.TableDecorator;

public class RowClickDecorate extends TableDecorator {

    @Override
    public String addRowId() {
        Object rowObject = this.getCurrentRowObject();
        Long id;
        try {
            id = (Long) PropertyUtils.getProperty(rowObject, "id");
        } catch (Exception e) {
            id = new Long(-1);
        }

        return "display_row_" + id + "\" keyId=" + id + "\" onclick=\"displayRowOnClick(" + id
                + ",this)\" ondblclick=\"displayRowOnDblClick(" + id + ",this)";
    }

}
